#include <iostream>
#include <memory>
#include "UdpServer.hpp"
#include "Dict.hpp"


void Usage(std::string pro)
{
    std::cout<<"Usage:\n\t"<<pro<<" local_port\n"<<std::endl;
}

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    EnableScreen();

    dict::Dict dict;
    
    uint16_t port=std::stoi(argv[1]);
    
    std::unique_ptr<UdpServer> usr=std::make_unique<UdpServer>(port,\
        std::bind(&dict::Dict::Translate,&dict,std::placeholders::_1,std::placeholders::_2));
    usr->InitServer();
    usr->Start();
    return 0;
}